<?php 

    ///Передаем массивы стран и языков    
    $arrc = sfCultureInfo::getInstance(sfContext::getInstance()->getUser()->getCulture())->getCountries();
    $arrl = sfCultureInfo::getInstance(sfContext::getInstance()->getUser()->getCulture())->getLanguages();    
    ////

?>
<table width="70%" class="table1">





<tr>
	<td width="250"><?php echo image_tag('/images/icons/Folder_Favorite.gif','style="float:left; padding-right: 15px"') ?>
		<div style="padding-top: 3px" >
		<?php if($filter=='fav'):?>
		<?php echo __('Мои друзья')?>
		<?php else: ?>
		<?php echo link_to(__('Мои друзья'),'@mailbox_input?filter=fav')?>
		<?php endif ?>
		</div>
	</td>
	<td><?php echo sfContext::getInstance()->getUser()->getProfile()->getCountFav() ?>&nbsp;<?php echo __(sfContext::getInstance()->getUser()->getUsersToStr(sfContext::getInstance()->getUser()->getProfile()->getCountFav()))?></td>
	<td><?php echo sfContext::getInstance()->getUser()->getProfile()->getCountFavMessage() ?>&nbsp;<?php echo __(sfContext::getInstance()->getUser()->getMessagesToStr(sfContext::getInstance()->getUser()->getProfile()->getCountFavMessage())) ?></td>	
	
</tr>

<tr>
	<td width="250"><?php echo image_tag('/images/icons/Folder_Income.gif','style="float:left; padding-right: 15px"') ?>
		<div style="padding-top: 3px" >
		<?php if($filter=='all'):?>
		<?php echo __('Кто меня добавил в друзья')?>
		<?php else: ?>
		<?php echo link_to(__('Кто меня добавил в друзья'),'@mailbox_input?filter=all')?>
		<?php endif ?>
		</div>
	</td>
	<td><?php echo sfContext::getInstance()->getUser()->getProfile()->getCountAll() ?>&nbsp;<?php echo __(sfContext::getInstance()->getUser()->getUsersToStr(sfContext::getInstance()->getUser()->getProfile()->getCountAll()))?></td>
	<td><?php echo sfContext::getInstance()->getUser()->getProfile()->getCountAllMessage() ?>&nbsp;<?php echo __(sfContext::getInstance()->getUser()->getMessagesToStr(sfContext::getInstance()->getUser()->getProfile()->getCountAllMessage())) ?></td>	
	
</tr>

<?php if(sfConfig::get('app_use_black_list')==true):?>
<tr>
	<td><?php echo image_tag('/images/icons/Folder_Blocked_s.gif','style="float:left; padding-right: 15px"') ?>
		<div style="padding-top: 3px" >
		<?php if($filter=='black'):?>
		<?php echo __('Черный список')?>
		<?php else: ?>
		<?php echo link_to(__('Черный список'),'@mailbox_input?filter=black')?>
		<?php endif ?>
		</div>
	</td>
	<td><?php echo sfContext::getInstance()->getUser()->getProfile()->getCountBlack() ?>&nbsp;<?php echo __(sfContext::getInstance()->getUser()->getUsersToStr(sfContext::getInstance()->getUser()->getProfile()->getCountBlack()))?></td>
	<td><?php echo sfContext::getInstance()->getUser()->getProfile()->getCountBlackMessage() ?>&nbsp;<?php echo __(sfContext::getInstance()->getUser()->getMessagesToStr(sfContext::getInstance()->getUser()->getProfile()->getCountBlackMessage())) ?></td>
</tr>
<?php endif ?>

<?php if(sfConfig::get('app_use_vocation')==true):?>
<tr>
	<td><?php echo image_tag('/images/icons/Folder_Deleted.gif','style="float:left; padding-right: 15px"') ?>
		<div style="padding-top: 3px" >
		<?php if($filter=='otpusk'):?>
		<?php echo __('В отпуске')?>
		<?php else: ?>
		<?php echo link_to(__('В отпуске'),'@mailbox_input?filter=otpusk')?>
		<?php endif ?>
		</div>
	</td>
	<td><?php echo sfContext::getInstance()->getUser()->getProfile()->getCountOtpusk() ?>&nbsp;<?php echo __(sfContext::getInstance()->getUser()->getUsersToStr(sfContext::getInstance()->getUser()->getProfile()->getCountOtpusk()))?></td>
	<td><?php echo sfContext::getInstance()->getUser()->getProfile()->getCountOtpuskMessage() ?>&nbsp;<?php echo __(sfContext::getInstance()->getUser()->getMessagesToStr(sfContext::getInstance()->getUser()->getProfile()->getCountOtpuskMessage())) ?></td>
	
</tr>
<?php endif ?>
</table>




<?php if ($fav->getResults()): ?>

<table width="100%" class="table1">
	<tr>
	<th><?php echo __('Автар')?></th>
	<th><?php echo __('Информация')?></th>
	<th><?php echo __('Действия')?></th>
	</tr>
<?php foreach($fav->getResults() as $f):?>
<?php 
if($f->getUserId()==sfContext::getInstance()->getUser()->getAttribute( 'user_id', null, 'sfGuardSecurityUser' ))
{
	$user = $f->getSfguardUserRelatedByFavId();
	
}
else 
{
	$user = $f->getSfguardUserRelatedByUserId();
	
}
?>

<?php if ($user): ?>
<tr>
	<td width="1%" >
	<?php echo $user->getLinkAvatar() ?>
	</td>
	<td>
	    <?php echo link_to($user,'@show_profile?id='.$f->getFavId()) ?>,
	    &nbsp;
	    <?php echo $user->getAge(); ?>&nbsp; <?php echo $user->getAgeToStr($user->getAge()); ?>
	    <br />
	    <?php echo $arrc[$user->getCountry()] ?> <br />
	    <?php if($user->getGender()=='m'): ?>
	    <?php echo __('Был')?>&nbsp;<?php echo format_date($user->getLastLogin(),'f')?>
	    <?php else: ?>
	    <?php echo __('Была')?>&nbsp;<?php echo format_date($user->getLastLogin(),'f')?>
	    <?php endif ?>
	    
	</td>


    <td>
		<table>
		
		<tr>
			<td width="1%">
				<?php echo image_tag('/images/icons/b_nonewmess.gif','style="float:left; padding-right: 10px"') ?>
			</td>
			<td>
				<?php echo $user->getCountFromToMessage($user->getId(),sfContext::getInstance()->getUser()->getAttribute( 'user_id', null, 'sfGuardSecurityUser' ))?>
				<?php if(sfConfig::get('app_mail_use_frame')==true):?>
		                               <?php use_helper("Highslide") ?>
		                              <?php  echo highslide_iframe('mailbox/personal?id='.$user->getId(), __(sfContext::getInstance()->getUser()->getMessagesToStr($user->getCountFromToMessage($user->getId(),sfContext::getInstance()->getUser()->getAttribute( 'user_id', null, 'sfGuardSecurityUser' )))), $options = array()) ?>
		         <?php else:?>
				<?php echo link_to(__(sfContext::getInstance()->getUser()->getMessagesToStr($user->getCountFromToMessage($user->getId(),sfContext::getInstance()->getUser()->getAttribute( 'user_id', null, 'sfGuardSecurityUser' )))),'mailbox/personal?id='.$user->getId(),array 
				        ( 
				            'popup' => array 
				            ( 
				                'Popup title', 
				                'width=450, height=640, left=320, top=0', 
				            ) 
				        ) 
				)?>
				<?php endif ?>
			</td>
		</tr>
		
		<?php if(sfConfig::get('app_use_black_list')==true):?>
		<tr>
			<td>
				<?php echo image_tag('/images/icons/Folder_Blocked_s.gif','style="float:left; padding-right: 10px"') ?>
			</td>
			<td>
				<?php if($filter=='all' or $filter=='otpusk' or $filter=='fav'): ?>
				<?php echo link_to(__('Добавить в черный список'),'mailbox/addblack?id='.$user->getId()); ?>
				<?php else: ?>
				<?php echo link_to(__('Удалить из черного списка'),'mailbox/delblack?id='.$user->getId()); ?>
				<?php endif ?>
			</td>
		</tr>
		<?php endif ?>
		
		
		
		<?php if($filter=='all'): ?>
		<tr>
		<td>
		<?php echo image_tag('/images/icons/Folder_Favorite.gif','style="float:left; padding-right: 10px"') ?>
		</td>
		<td>
		<?php echo link_to(__('Добавить в друзья'),'mailbox/addfav?id='.$user->getId()); ?>
		</td>
		</tr>
		<?php elseif($filter=='fav'): ?>
		<tr>
		<td>
		<?php echo image_tag('/images/icons/Folder_Favorite.gif','style="float:left; padding-right: 10px"') ?>
		</td>
		<td>
		<?php echo link_to(__('Удалить из друзей'),'mailbox/delfav?id='.$user->getId()); ?>
		</td>
		</tr>
		<?php endif ?>
		</table>
	</td>
</tr>
<?php else: ?>
<tr><td colspan="3"><?php echo __('Пользователь не найден')?></td></tr>
<?php endif ?>
<?php endforeach ?>
</table>

<?php else: ?>
<center><?php echo __('Нет результатов')?> </center>
<?php endif ?>